package com.yanchengtect.demo.progress.common;
/**
* @author 文心雕龙 Email：xuwenlong@shike8888.com
* @version 创建时间：2018年9月5日 上午11:46:05
* 类说明
*/

import java.util.List;

public class PageBean<T> {

	private int totalCount;  // 总条数
	
	private int pageNum;	// 页码,传入0和1都表示第一页	
	
	private int pageSize;	//每页显示的条数
	
	private List<T> pageData;	// 分页查询的结果集
	
	private int startNum; 	//分页查询的起始记录数
	
	private int totalPageCount; 	//总页数

	 
	public int getTotalPageCount() {
		return totalPageCount;
	}

	private void setTotalPageCount(int pageTotalCount) {
		this.totalPageCount = pageTotalCount;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
		setTotalPageCount(totalCount % pageSize==0?totalCount/pageSize:totalCount/pageSize+1);
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		 
		this.pageNum = pageNum>0?pageNum:1;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public List<T> getPageData() {
		return pageData;
	}

	public void setPageData(List<T> pageData) {
		this.pageData = pageData;
	}

	public int getStartNum() {
		setStartNum(this.startNum = (this.pageNum-1) * this.pageSize);
		return this.startNum;
	}

	private void setStartNum(int startNum) {
		this.startNum = startNum;
	}

	public PageBean(int pageNum, int pageSize) {
		super();
		this.setPageNum(pageNum);;
		this.pageSize = pageSize;
	}

	public PageBean() {
		super();
	}
	
	
}
